package gui.kat;

import javax.swing.*;
import java.util.HashMap;
import java.util.Map;

public abstract class Kategori extends JButton{
    private int index;
    public Kategori(String emri,int index){
        super();
        setText(emri);
        setSize(80,40);
        this.index=index;
    }

    public abstract int llogaritPiket(int zarat[]);

    public static final int NJESHA = 1;
    public static final int DYSHA = 2;
    public static final int TRESHA = 3;
    public static final int KATRA = 4;
    public static final int PESA = 5;
    public static final int GJASHTA = 6;
    public static final int PIKET_SIPERME = 7;
    public static final int BONUS = 8;
    public static final int TRE_NJESOJ = 9;
    public static final int KATER_NJESOJ = 10;
    public static final int TRE_DHE_DY = 11;
    public static final int KATER_TE_NJEPASNJESHME=12;
    public static final int PESE_TE_NJEPASNJESHME=13;
    public static final int PESE_NJESOJ=14;
    public static final int CDO_RAST=15;
    public static final int PIKET_POSHTME=16;
    public static final int TOTALI=17;



    public static final Map<Integer,Kategori> kategorite=createMap();

    private static Map<Integer,Kategori> createMap(){
        HashMap<Integer,Kategori> kat=new HashMap<Integer, Kategori>();
        kat.put(NJESHA,new KategoriNjesha(NJESHA));
        kat.put(DYSHA,new KategoriDysha(DYSHA));
        kat.put(TRESHA,new KategoriTresha(TRESHA));
        kat.put(KATRA,new KategoriKatra(KATRA));
        kat.put(PESA,new KategoriPesa(PESA));
        kat.put(GJASHTA,new KategoriGjashta(GJASHTA));
        kat.put(TRE_NJESOJ,new KategoriTreNjesoj(TRE_NJESOJ));
        kat.put(KATER_NJESOJ,new KategoriKaterNjesoj(KATER_NJESOJ));
        kat.put(TRE_DHE_DY,new KategoriTreDheDy(TRE_DHE_DY));
        kat.put(KATER_TE_NJEPASNJESHME,new KategoriKaterNjepasnjeshme(KATER_TE_NJEPASNJESHME));
        kat.put(PESE_TE_NJEPASNJESHME,new KategoriPeseNjepasnjeshme(PESE_TE_NJEPASNJESHME));
        kat.put(PESE_NJESOJ,new KategoriPeseNjesoj(PESE_NJESOJ));
        kat.put(CDO_RAST,new KategoriTjeter(CDO_RAST));
        return kat;
    }

    public int getIndex() {
        return index;
    }
}
